<template>
  <div>
      <h1 v-text="msg" ref="title"></h1>
      <button @click="alert">点击此处提示上方元素</button>
      <School ref="school"></School>
  </div>
</template>

<script>
    import School from './components/School'
    export default {
        name:'App',
        data() {
            return {
                msg:'Welcome to the world of Vue'
            }
        },
        methods: {
            alert(){
                console.log(this.$refs.title);  //获取真实DOM元素
                console.log(this.$refs.school); //school中的实例对象
            }
        },
        components:{School},
    }

</script>
